import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
// import login from "../views/login/index.vue";
import HomeView from "../views/HomePage.vue"
import UserOne from "../views/HomeChildren/UserOne.vue"
import  UserList from "../views/HomeChildren/UserList.vue"
const routes: Array<RouteRecordRaw> = [
  // 登录页
  {
    path: '/',
    redirect:"/login"
   },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login/LoginPage.vue')
    
  },
// 首页
// 首页路由
{
  path: '/home',
  name: 'home',
 
  // component: () => import('../views/HomeView/HomeView.vue')
  component: HomeView,
  // 设置二级路由
 children: [
  {
    path: '/echarts',
    name: 'echarts',
    component: () => import('../views/HomeChildren/EchartsView.vue'),
    meta:{
      title:"数据展示"
    }
  },
  {
    path: '/permissionlist',
    name: 'permissionlist',
    component: () => import('../views/HomeChildren/PermissionList.vue'),
    meta:{
      title:"权限列表"
    }
  },
  {
    path: "/user",
    name: "user",
    // component: () => import("../views/HomeChildren/UserOne.vue"),
    component: UserOne,
    redirect:"/userlist",
    meta:{
      title:"住户信息"
    },
    children: [
      {
        path: '/userlist',
        name: 'userlist',
        // component: () => import('../views/HomeChildren/UserList.vue'),
        component:UserList,
        meta:{
          classifyTitle: "用户信息",//分类标题
          title:"住户信息"
        }
      },
      {
        path: '/userupdate',
        name: 'userupdate',
        component: () => import('../views/HomeChildren/UserUpdate.vue'),
        meta:{
          classifyTitle: "用户信息",//分类标题
          title:"住户信息修改"
        }
      },
    ]
  }
]
 },

  // {
  //   path: '/about',
  //   name: 'about',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  // }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
